// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Axios from 'axios'
import store from "./store"
import filter from "./filter"
import qs from "qs"
import ZkTable from 'vue-table-with-tree-grid'
import base from '../static/js/base.js'
import messageDialog from './components/dialog/messageDialog'


Vue.use(ZkTable);
Vue.use(base);
//Vue.use(AJax);
Vue.component('messageDialog',messageDialog);

Vue.prototype.$qs = qs;
// require  ('../static/js/layout.js');

//拦截器
Axios.interceptors.request.use(function (config) {
  //在发送请求之前做什么
  ////console.log(config);
  if( config.method === "post" ){
   ////console.log(config.data);
  }else if(config.method === "get"){
   // //console.log(config);
  }

  return config;
},function(err){
  //对请求错误时做什么
  return Promise.reject(err)
});
//服务器响应拦截器
Axios.interceptors.response.use(function (config) {
  //在响应数据做点什么
  ////console.log(config);
  //Vue.prototype.logWrite(config);
  return config;
},function(err){
  //对响应错误时做什么
  return Promise.reject(err)
});

Vue.config.productionTip = false;
Vue.prototype.$axios = Axios;

////console.log("后台管理系统发布日期: 2018-11-26 16：32；版本号：2.0.04");
//console.log("测试后台管理系统发布日期: 2018-12-03 ；版本号：2.0.05");

Vue.prototype.webAdmin = webAdminURL;
Vue.prototype.bindPoliceFacility = 'hn/bindPoliceFacility';
Vue.prototype.upDataFile = '/upDataFile'; //文件微服务

if( typeUrl === "localhost" ){
  Vue.prototype.HOST = '/api'; //本地开发环境  打包注释这个
  Vue.prototype.policeFacility = '/policeFacility'; //警员物资 打包注释这
  Vue.prototype.DotCtrl ='/Dot' ; //点位管理
  Vue.prototype.ControlObject = '/ControlObject'; //重点人
  Vue.prototype.Dictionary = '/Dictionary'; // 字典
  Vue.prototype.Beacon = '/Beacon'; // 中台监控
}else {
  Vue.prototype.HOST = baseURL+"api/jp-HCZZ-AdminWeb-app-ms"; //打包使用这个地址 核心微服务地址
  Vue.prototype.policeFacility = baseURL + "api/jp-BIRM-PoliceFacility-ms";  //打包使用这个地址 警员物资微服务
  Vue.prototype.DotCtrl = baseURL + "api/jp-BIRM-Resource-ms"; //点位管理
  Vue.prototype.ControlObject = baseURL + "api/jp-BIRM-ControlObject-ms";
  //重点人
  Vue.prototype.Dictionary = baseURL + "api/jp-Configuration-Dictionary-atom-ms"; // 字典
  Vue.prototype.Beacon = baseURL + 'api/jp-msa-beacon-monitor-ms'; // 中台监控
  // Vue.prototype.Beacon = '/Beacon'; // 中台监控
}


Axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
//Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*';
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  filter,
  components: { App },
  template: '<App/>'
});


